<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 构造函数的缺点 */
        /* 公有的属性或者公有的方法我们可以放在原型对象上 */
        function Person(name,age){
            this.name = name
            this.age = age
        }
        Person.prototype.eat = "水果"
        var p = new Person("li",19)
        var zhang = new Person("zhang",20)
        console.log(p);
        console.log(zhang);
    </script>
</body>
</html>